package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;

import com.chanyachting.emall.util.RequestUtil;

public class MemberForm extends ActionForm{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	
	private java.lang.Integer id;

	// fields
	private java.lang.String password;
	private java.lang.String beginDate;
	private java.lang.String backupEmail;
	private java.lang.String account;
	private java.lang.String loginDate;
	private java.lang.String registDate;
	private java.lang.String registIP;
	
	private java.lang.String status;
	private java.lang.String webContact;
	private java.lang.String blog;
	private java.lang.String imgUrl;
	private java.lang.String sex;
	private java.lang.String memberType;
	private java.lang.String jobType;
	private java.lang.String job;
	private java.lang.String email;
	private java.lang.String endDate;
	private java.lang.String area;
	private java.lang.String loginIP;
	
	private String memberName;
	private String memberBirthday;
	
	private String newPassword;
	private String newEmail;
	
	private String confNewPassword;
	private String confNewEmail;
	
	
	
	private FormFile file;
	
	

	public String getConfNewPassword() {
		return confNewPassword;
	}

	public void setConfNewPassword(String confNewPassword) {
		this.confNewPassword = confNewPassword;
	}

	public String getConfNewEmail() {
		return confNewEmail;
	}

	public void setConfNewEmail(String confNewEmail) {
		this.confNewEmail = confNewEmail;
	}

	public FormFile getFile() {
		return file;
	}

	public void setFile(FormFile file) {
		this.file = file;
	}
	
	
	
	
	
	
	
	
	
	public String getNewEmail() {
		return newEmail;
	}
	public void setNewEmail(String newEmail) {
		this.newEmail = newEmail;
	}
	public String getNewPassword() {
		return newPassword;
	}
	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}
	public String getMemberName() {
		return memberName;
	}
	public void setMemberName(String memberName) {
		this.memberName = memberName;
	}
	public String getMemberBirthday() {
		return memberBirthday;
	}
	public void setMemberBirthday(String memberBirthday) {
		this.memberBirthday = memberBirthday;
	}
	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.String getPassword() {
		return password;
	}
	public void setPassword(java.lang.String password) {
		this.password = password;
	}
	public java.lang.String getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(java.lang.String beginDate) {
		this.beginDate = beginDate;
	}
	public java.lang.String getBackupEmail() {
		return backupEmail;
	}
	public void setBackupEmail(java.lang.String backupEmail) {
		this.backupEmail = backupEmail;
	}
	public java.lang.String getAccount() {
		return account;
	}
	public void setAccount(java.lang.String account) {
		this.account = account;
	}
	public java.lang.String getLoginDate() {
		return loginDate;
	}
	public void setLoginDate(java.lang.String loginDate) {
		this.loginDate = loginDate;
	}
	public java.lang.String getRegistDate() {
		return registDate;
	}
	public void setRegistDate(java.lang.String registDate) {
		this.registDate = registDate;
	}
	public java.lang.String getRegistIP() {
		return registIP;
	}
	public void setRegistIP(java.lang.String registIP) {
		this.registIP = registIP;
	}
	public java.lang.String getStatus() {
		return status;
	}
	public void setStatus(java.lang.String status) {
		this.status = status;
	}
	public java.lang.String getWebContact() {
		return webContact;
	}
	public void setWebContact(java.lang.String webContact) {
		this.webContact = webContact;
	}
	public java.lang.String getBlog() {
		return blog;
	}
	public void setBlog(java.lang.String blog) {
		this.blog = blog;
	}
	public java.lang.String getImgUrl() {
		return imgUrl;
	}
	public void setImgUrl(java.lang.String imgUrl) {
		this.imgUrl = imgUrl;
	}
	public java.lang.String getSex() {
		return sex;
	}
	public void setSex(java.lang.String sex) {
		this.sex = sex;
	}
	public java.lang.String getMemberType() {
		return memberType;
	}
	public void setMemberType(java.lang.String memberType) {
		this.memberType = memberType;
	}
	public java.lang.String getJobType() {
		return jobType;
	}
	public void setJobType(java.lang.String jobType) {
		this.jobType = jobType;
	}
	public java.lang.String getJob() {
		return job;
	}
	public void setJob(java.lang.String job) {
		this.job = job;
	}
	public java.lang.String getEmail() {
		return email;
	}
	public void setEmail(java.lang.String email) {
		this.email = email;
	}
	public java.lang.String getEndDate() {
		return endDate;
	}
	public void setEndDate(java.lang.String endDate) {
		this.endDate = endDate;
	}
	public java.lang.String getArea() {
		return area;
	}
	public void setArea(java.lang.String area) {
		this.area = area;
	}
	public java.lang.String getLoginIP() {
		return loginIP;
	}
	public void setLoginIP(java.lang.String loginIP) {
		this.loginIP = loginIP;
	}
	
	
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		ActionErrors errors=new ActionErrors();
		
		String msg="";
		
		if(this.getAccount()==null || this.getAccount().trim().equals("")){
			
			errors.add("sellname", new ActionMessage("errors.businesstype.nameEmpty")); 
			
			msg+="Account must not null!";
			
		}
		
		
		if(this.getPassword()==null || this.getPassword().trim().equals("")){
			
			errors.add("sellname", new ActionMessage("errors.businesstype.nameEmpty")); 
			
			msg+="Password must not null!";
			
		}
		
		new RequestUtil(request).setMsg(msg);
		
		return errors;
	}

}
